#pragma once

#include < opencv2/highgui/highgui.hpp >

#include "DataCapture.hxx"
#include "AppSetting.hxx"

class ChannelMp4Capture
{
public:
	ChannelMp4Capture(void);
	~ChannelMp4Capture(void);
	int CreateReadMp4Thread();
	int StopMp4FileCapture();
	//int ConnectFile();

	inline BOOL IsReadFrameThreadEnd() { return _bReadFrameThreadEnd; }

	inline FILE* getFile(int ChannelId) { return pFile[ ChannelId ];};
	inline char* getFileName(int ChannelId){return _fileName[ ChannelId ];};

	inline DataCapture* getDataCapture() { return _dataCapture; }
	inline void setDataCapture( DataCapture* capture ) { _dataCapture = capture; }

	inline void SetChannelId( int id ) { _iChannelId = id; }
	inline int GetChannelId() { return _iChannelId; }

	inline void SetDispWnd( HWND wnd ) { _dispWnd = wnd; }

	void setDirFileName(char* filename,int ChannelId);
	void IplImageDataToYUV(IplImage* pImage,char *buf);

private:

	HWND	_dispWnd;
	int _iChannelId;
	char _fileName[3][256];
	FILE *pFile[3];
	char* frameBuf;

	HANDLE _hReadFrameThread;
	BOOL _bReadFrameThreadEnd;

	//BOOL _bReading;
	//HANDLE _hWriteFrameThread;
	DataCapture* _dataCapture;

};

